<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="include.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
<%@ include file="head.jsp"%>
<title>Cart</title>
</head>

<body>
	<div class="container">
		<%@ include file="header.jsp"%>
		<div class="row">
			<div class="span12">
				<h1>Shopping Cart</h1>
				<br />
				<form:form method="POST" action="${pageContext.request.contextPath}/shopping/cart-update">
				<table class="table table-bordered table-striped">
					<thead>
						<tr>
							<th>Remove</th>
							<th>Image</th>
							<th>Product Name</th>
							<th>Color</th>
							<th>Quantity</th>
							<th>Unit Price</th>
							<th>Total</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${cart}" var="item">
							<tr>
								<td class=""><input type="checkbox" value="${item.id}"
									name="ids"></td>
								<td class="muted center_text">
								<a href="${pageContext.request.contextPath}/product/detail/${item.id }"><img alt="" width="130" heigh="130" src="${pageContext.request.contextPath}/<spring:url value="${item.imagepath}"/>" /></a>
								</td>
								<td>${item.name}</td>
								<td>${item.color}</td>
								<td><input type="text" placeholder="1" name="quatities" value="${item.quatity}" class="input-mini"></td>
								<td>&#36;${item.price}</td>
								<td>&#36;${item.price * item.quatity}</td>
							</tr>
						</c:forEach>
						<tr>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td><strong>&#36;${total}</strong></td>
						</tr>
					</tbody>
				</table>
						<div class="row">
							<div class="span5">
								<button class="btn btn-primary" type="submit">Update</button>
							</div>
							<div class="span2">
								<a class="btn btn-primary" href="${pageContext.request.contextPath}/home">Continue shopping</a>
							</div>
							<div class="span5">
								<a href="${pageContext.request.contextPath}/shopping/checkout" class="btn btn-primary pull-right">Checkout</a>
							</div>
						</div>
						</form:form>
			</div>
		</div>
		<%@ include file="footer.jsp"%>
	</div>
</body>
</html>